package org.ice4apps.talk.dao;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * TalkUser entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "talk_user", catalog = "icetalk", uniqueConstraints = @UniqueConstraint(columnNames = { "username",
                                                                                                     "domain" }))
public class TalkUser implements java.io.Serializable {
    // Fields
    private String            id;
    private TalkOffice        talkOffice;
    private String            username;
    private String            domain;
    private String            password;
    private Long              features;
    private Long              addon;
    private Short             firstPartyRegistrationLimit;
    private Long              creationdate;
    private Long              updationdate;
    private Set<Extension>    extensions    = new HashSet<Extension> (0);
    private Set<PublicNumber> publicNumbers = new HashSet<PublicNumber> (0);
    private Set<Registration> registrations = new HashSet<Registration> (0);

    // Constructors
    /** default constructor */
    public TalkUser () {
    }

    /** minimal constructor */
    public TalkUser (String id,
                     TalkOffice talkOffice,
                     String username,
                     String domain,
                     String password,
                     Long creationdate) {
        this.id = id;
        this.talkOffice = talkOffice;
        this.username = username;
        this.domain = domain;
        this.password = password;
        this.creationdate = creationdate;
    }

    /** full constructor */
    public TalkUser (String id,
                     TalkOffice talkOffice,
                     String username,
                     String domain,
                     String password,
                     Long features,
                     Long addon,
                     Short firstPartyRegistrationLimit,
                     Long creationdate,
                     Long updationdate,
                     Set<Extension> extensions,
                     Set<PublicNumber> publicNumbers,
                     Set<Registration> registrations) {
        this.id = id;
        this.talkOffice = talkOffice;
        this.username = username;
        this.domain = domain;
        this.password = password;
        this.features = features;
        this.addon = addon;
        this.firstPartyRegistrationLimit = firstPartyRegistrationLimit;
        this.creationdate = creationdate;
        this.updationdate = updationdate;
        this.extensions = extensions;
        this.publicNumbers = publicNumbers;
        this.registrations = registrations;
    }

    // Property accessors
    @Id
    @Column(name = "id", unique = true, nullable = false, length = 36)
    public String getId () {
        return this.id;
    }

    public void setId (String id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "office", nullable = false)
    public TalkOffice getTalkOffice () {
        return this.talkOffice;
    }

    public void setTalkOffice (TalkOffice talkOffice) {
        this.talkOffice = talkOffice;
    }

    @Column(name = "username", nullable = false, length = 36)
    public String getUsername () {
        return this.username;
    }

    public void setUsername (String username) {
        this.username = username;
    }

    @Column(name = "domain", nullable = false, length = 128)
    public String getDomain () {
        return this.domain;
    }

    public void setDomain (String domain) {
        this.domain = domain;
    }

    @Column(name = "password", nullable = false)
    public String getPassword () {
        return this.password;
    }

    public void setPassword (String password) {
        this.password = password;
    }

    @Column(name = "features")
    public Long getFeatures () {
        return this.features;
    }

    public void setFeatures (Long features) {
        this.features = features;
    }

    @Column(name = "addon")
    public Long getAddon () {
        return this.addon;
    }

    public void setAddon (Long addon) {
        this.addon = addon;
    }

    @Column(name = "first_party_registration_limit")
    public Short getFirstPartyRegistrationLimit () {
        return this.firstPartyRegistrationLimit;
    }

    public void setFirstPartyRegistrationLimit (Short firstPartyRegistrationLimit) {
        this.firstPartyRegistrationLimit = firstPartyRegistrationLimit;
    }

    @Column(name = "creationdate", nullable = false)
    public Long getCreationdate () {
        return this.creationdate;
    }

    public void setCreationdate (Long creationdate) {
        this.creationdate = creationdate;
    }

    @Column(name = "updationdate")
    public Long getUpdationdate () {
        return this.updationdate;
    }

    public void setUpdationdate (Long updationdate) {
        this.updationdate = updationdate;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "talkUser")
    public Set<Extension> getExtensions () {
        return this.extensions;
    }

    public void setExtensions (Set<Extension> extensions) {
        this.extensions = extensions;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "talkUser")
    public Set<PublicNumber> getPublicNumbers () {
        return this.publicNumbers;
    }

    public void setPublicNumbers (Set<PublicNumber> publicNumbers) {
        this.publicNumbers = publicNumbers;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "talkUser")
    public Set<Registration> getRegistrations () {
        return this.registrations;
    }

    public void setRegistrations (Set<Registration> registrations) {
        this.registrations = registrations;
    }
}